package com.lovo.psc.bean;

import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Getter;
import lombok.NoArgsConstructor;
import lombok.Setter;

import java.time.LocalDate;
import java.util.List;

@Setter
@Getter
@NoArgsConstructor
@TableName("psc_order")
@ApiModel(value = "供货订单表",description = "供货订单表")
public class OrderBean {
    @TableId(value = "pk_orderId",type = IdType.AUTO)
    @ApiModelProperty("供货订单主键")
    private long orderId;
    @TableField("fk_bidId")
    @ApiModelProperty("投标书主键")
    private long bidId;
    @TableField("o_idNum")
    @ApiModelProperty("供货订单编号")
    private String idNum = "Z"+System.currentTimeMillis();
    @TableField("o_vendorName")
    @ApiModelProperty("供应商名")
    private String vendorName;
    @TableField("o_buyTime")
    @ApiModelProperty("下单时间")
    private LocalDate buyTime = LocalDate.now();
    @TableField("o_status")
    @ApiModelProperty("0-供货中  1-已完成  2-未完成 ")
    private int status =0;
    @TableField(exist = false)
    @ApiModelProperty("前端展示状态")
    private String newStatus = "供货中";
    @TableField("o_buyNum")
    @ApiModelProperty("供货数量")
    private int buyNum;

    public OrderBean(long bidId, int buyNum, int rest, float totalMoney) {
        this.bidId = bidId;
        this.buyNum = buyNum;
        this.rest = rest;
        this.totalMoney = totalMoney;
    }

    @TableField("o_rest")
    @ApiModelProperty("未供货数量")
    private int rest;
    @TableField("o_totalMoney")
    @ApiModelProperty("订单总金额")
    private float totalMoney;
    @TableField("o_getMoney")
    @ApiModelProperty("已结算金额")
    private float getMoney =0;
    @TableField(exist = false)
    @ApiModelProperty("供货批次集合")
    private List<OrderInfoBean> orderInfoBean;

    @Override
    public String toString() {
        return "Order{" +
                "orderId=" + orderId +
                ", bidId=" + bidId +
                ", idNum='" + idNum + '\'' +
                ", vendorName='" + vendorName + '\'' +
                ", buyTime='" + buyTime + '\'' +
                ", status=" + status +
                ", buyNum=" + buyNum +
                ", rest=" + rest +
                ", totalMoney=" + totalMoney +
                ", getMoney=" + getMoney +
                '}';
    }
}
